/**
 * 扩展类型 (extends)
 * */
// 1、不够优雅，代码冗余
interface basicAddress {
  name?: string,
  street: string,
  city: string,
  country: string,
  postalCode: string
}

// interface addressWithUint {
//   // ...
//   unit: string
// }

// 2、extends
interface addressWithUnit extends basicAddress {
  unit: string
}

let awu: addressWithUnit = {
  unit: '三单元',
  street: '黄河街道',
  city: '北京',
  country: '朝阳',
  postalCode: '1000'
}

// 扩展多个接口需要使用逗号隔开
interface Color_ext {
  color: string
}

interface Circle_ext {
  radius: number
}

interface Name_ext { 
  name: string
}

interface Color_extAndCircle_ext extends Color_ext, Circle_ext {}

let CAC: Color_extAndCircle_ext = {
  color: 'red',
  radius: 100
}

interface ColorCircleName_ext extends Color_ext, Circle_ext, Name_ext {
  age: number
}

let CCN: ColorCircleName_ext = {
  color: 'red',
  radius: 100,
  name: '123',
  age: 18,
}